Skip to content

Enhance Metadata Generation with "Used By" Tracking#774

Open
0xHericles wants to merge 3 commits intomainfrom
feat/used-by
Open

Enhance Metadata Generation with "Used By" Tracking#774
0xHericles wants to merge 3 commits intomainfrom
feat/used-by

Conversation

@0xHericles
Copy link
Contributor

Description

This PR enhances the metadata generation process by introducing a usedBy field to track where each saved block is utilized across the project

Key Changes:

usedBy Tracking: Added logic to identify and record references between saved blocks, updating the metadata with this information.

Example (from blocks.json):

{
  "/.deco/blocks/Footer.json": {
    "blockType": "sections",
    "__resolveType": "site/sections/Footer.tsx",
    "usedBy": [
      "/.deco/blocks/pages-test-3c04f2690620.json",
      "/.deco/blocks/pages-home-5afd25174424.json",
      "/.deco/blocks/pages-testing-a5c1b57018a9.json"
    ]
  }
}

@0xHericles 0xHericles requested a review from tlgimenes August 15, 2024 16:26
if (key === "__resolveType" && typeof value === "string" && !isRoot) {
const blockName = value.split("/").pop();
if (blockName) {
const blockPath = Array.from(blocks.keys()).find((path) =>
Copy link
Contributor

@tlgimenes tlgimenes Aug 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isso aqui nao é lento nao? criar um array dos e fazer um find para cada prop de cada block, ainda mais recursivamente assim?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants